package com.hzeport.bgs22emduty.inbound.api;

import com.hzeport.assembly.hzeportIdem.annotaion.IdemAnnotation;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.ScreenCheckSaveDTO;
import com.hzeport.bgs22emduty.entity.ScreenCheck;
import com.hzeport.bgs22emduty.service.ScreenDutyCheckService;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@AllArgsConstructor
@RequestMapping("/screenLsCheck")
@Api(value = "screenLsCheck", tags = "值班抽查管理LS")
@Slf4j
@CrossOrigin
public class ScreenCheckLSController {

    private final ScreenDutyCheckService screenCheckService;

    /**
     * 修改${comments}
     * @param screenCheck ${comments}
     * @return R
     */
    @ApiOperation(value = "save", notes = "save")
    //@SysLog(.*)c
    @PostMapping("save")
    @OperLog(systemName = "ZBCC",description = "CCBC")
    @IdemAnnotation
    public BaseResult save( @RequestBody ScreenCheckSaveDTO screenCheckSaveDTO , HttpServletRequest request ) throws Exception{
        return BaseResult.ok(screenCheckService.saveTwo(screenCheckSaveDTO,request));
    }


    /**
     * 修改${comments}
     * @param screenCheck ${comments}
     * @return R
     */
    @ApiOperation(value = "getNextCustoms", notes = "getNextCustoms")
    //@SysLog(.*)
    @GetMapping("getNextCustoms")
    public BaseResult getNextCustoms(@RequestParam(value = "type",required = false)String type
    ,@RequestParam(value = "customId",required = false)String customId) {
        return BaseResult.ok(screenCheckService.getNextCustoms(type,customId));
    }


    /**
     * 修改${comments}
     * @param screenCheck ${comments}
     * @return R
     */
    @ApiOperation(value = "getThisCustomResult", notes = "getThisCustomResult")
    //@SysLog(.*)
    @GetMapping("getThisCustomResult")
    public BaseResult getThisCustomResult(@RequestParam(value = "customId",required = false)String customId) {
        return BaseResult.ok(screenCheckService.getThisCustomResult(customId));
    }
}
